<template>
  <div class="nav-header">
    <el-menu
      :default-active="activeIndex"
      class="nav-menu"
      mode="horizontal"
      router
    >
      <!-- <div class="logo">
        <router-link to="/">
          <img src="@/assets/logo.png" alt="DataTool" />
        </router-link>
      </div> -->
      
      <el-menu-item index="/">{{ $t('nav.home') }}</el-menu-item>
      <el-menu-item index="/download">{{ $t('nav.download') }}</el-menu-item>
      <el-menu-item index="/blog">{{ $t('nav.blog') }}</el-menu-item>
      <el-menu-item index="/faqs">{{ $t('nav.faqs') }}</el-menu-item>

      <div class="right-menu">
        <el-dropdown @command="handleLanguageChange">
          <span class="el-dropdown-link">
            {{ currentLanguage === 'en' ? 'English' : '中文' }}
            <i class="el-icon-arrow-down el-icon--right"></i>
          </span>
          <el-dropdown-menu slot="dropdown">
            <el-dropdown-item command="en">English</el-dropdown-item>
            <el-dropdown-item command="zh">中文</el-dropdown-item>
          </el-dropdown-menu>
        </el-dropdown>
      </div>
    </el-menu>
  </div>
</template>

<script>
import { mapState } from 'vuex'

export default {
  name: 'NavHeader',
  computed: {
    ...mapState(['currentLanguage']),
    activeIndex() {
      return this.$route.path
    }
  },
  methods: {
    handleLanguageChange(lang) {
      this.$store.dispatch('changeLanguage', lang)
      this.$i18n.locale = lang
    }
  }
}
</script>

<style lang="scss" scoped>
.nav-header {
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
  
  .nav-menu {
    display: flex;
    align-items: center;
    padding: 0 20px;
  }

  .logo {
    margin-right: 40px;
    
    img {
      height: 40px;
    }
  }

  .right-menu {
    margin-left: auto;
    
    .el-dropdown-link {
      cursor: pointer;
      color: #409EFF;
    }
  }
}
</style> 